import 'dart:convert';

import 'package:flutter_mwm/beans/bean.dart';
import 'package:flutter_mwm/util/util.dart';

void main() {
  String jsonStr =
      '{"code":"1","obj":{"account":"loyal","password":"111111","nickname":"loyal","sign":"y","locked":0}}';
  //print(jsonStr);
  var user = ReturnAccountBean.json2Bean(jsonStr);
  //print(json.encode(user.obj));
  Map<String, dynamic> map = {};

  /*map.putIfAbsent("code", () => "-1");
  map.putIfAbsent("message", () => "fail");
  map.putIfAbsent("obj", () => "error");
  ReturnBean returnBean = ReturnBean.fromJson(map);
  print(returnBean.code);
  print(returnBean.message);*/
  AccountBean accountBean =
  AccountBean(username: "l6yang", password: "admin", nickname: "loyal");
  Log.out(accountBean.toJson());
  Log.out('---------');
  Log.out(accountBean.bean2Json());
  Log.out('---------');
  Log.out(GsonUtil.bean2Json(accountBean));
  Log.out('---------');
  List<AccountBean> temp=List();
  temp.add(accountBean);
  Log.out(GsonUtil.list2Json(temp));
}
